#include <cstdio>
#include <iostream>

using namespace std;

bool visit[ 1000001 ];

int main( )
{
    memset( visit, false, sizeof( visit ) );
    int i, j, t;
    for ( i = 1; i <= 1000000; i++ )
        if ( !visit[ i ] )
        {
            printf("%d\n", i);
            j = i;
            while ( j <= 1000000 && !visit[ j ] )
            {
                visit[ j ] = true;
                t = j;
                while ( t )
                {
                    j += t % 10;
                    t /= 10;
                }
            }
        }
    return 0;
}
